
import 'package:flutter_getx/core/net/net.dart';
import 'package:flutter_getx/ui/main/model/index_data.dart';
import 'package:get/get.dart';

import 'home_logic.dart';

class HomeApi {

  final _logic = Get.find<HomeLogic>();
  final _dio = Get.find<HomeLogic>().dio;
  final _state = Get.find<HomeLogic>().state;

  Future<void> loadData(bool refresh) async {
    await _dio.request<dynamic>(Method.get, url: api_home, state: _state, onSuccess: (data) {
      _logic.setIndexData(IndexData.fromJson(data));
    });
  }
}